<?php
namespace Models;
class Model{

    public $pdo = null;

    public function __construct()
    {
        // 1. 定义dsn
        $dsn = 'mysql:host=localhost;dbname=library;charset=utf8';
        // 2. 连接数据，实例化PDO类的一个对象
        $this->pdo = new \PDO($dsn, 'root', '123456');
    }
}